using System;
using SBCommon.Data;
using SBCommon.Validation;

namespace SecurityModule.Entity
{
    [Table("[SEC_DataObject]")]
    public class DataObject : IDataBoundEntity
    {
        int _dataobject_id;
        [Column(IsPrimaryKey = true)]
        [Validator(Required = true)]
        public int dataobject_id
        {
            get { return _dataobject_id; }
            set { _dataobject_id = value; }
        }

        string _dataobject_no;
        [Column]
        [Validator(MaxLength = 50)]
        public string dataobject_no
        {
            get { return _dataobject_no; }
            set { _dataobject_no = value; }
        }

        string _dataobject_name;
        [Column]
        [Validator(MaxLength = 50, Required = true)]
        public string dataobject_name
        {
            get { return _dataobject_name; }
            set { _dataobject_name = value; }
        }

        int _parent_id;
        [Column]
        [Validator(Required = true)]
        public int parent_id
        {
            get { return _parent_id; }
            set { _parent_id = value; }
        }

        #region TreeNodeAdaptor Members

        public string Text
        {
            get { return this.dataobject_name.ToString(); }
        }

        public string Value
        {
            get { return this.dataobject_id.ToString(); }
        }

        public string ParentValue
        {
            get { return this.parent_id.ToString(); }
        }

        public string ItemTextColoumn
        {
            get { return "dataobject_name"; }
        }

        public string ItemValueColoumn
        {
            get { return "dataobject_id"; }
        }

        public string ParentColoumn
        {
            get { return "parent_id"; }
        }

        #endregion
    }
}

